import Vue from 'vue';
import VueRouter from "vue-router";
import TeacherMain from '@/components/teacher/Main/Main';
import Login from '@/components/common/Login/Login';
import FinderMain from '@/components/finder/Main/Main';
import Print from '@/components/admin/ToPrint/ToPrint';

// 使用路由组件
Vue.use(VueRouter);

export default new VueRouter({
    mode: 'history',
    routes: [
        {
            path: '/',
            redirect: '/teacherMain'
        },
        {
            path: '/login',
            component: Login
        },
        {
            path: '/teacherMain',
            component: TeacherMain
        },
        {
            path: '/print',
            name: 'toPrintOrder',
            component: Print
        },
        {
            path: '/finder',
            component: FinderMain,
            children: [
                {
                    path: 'info',
                    component: () => import('@/components/finder/Info/Info'),
                }, {
                    path: 'task',
                    component: () => import('@/components/finder/Task/Task')
                }, {
                    path: 'pwd',
                    component: () => import('@/components/finder/UpdatePwd/UpdatePwd')
                }, {
                    path: 'updateInfo',
                    component: () => import('@/components/finder/UpdateInfo/UpdateInfo')
                }
            ]
        },
        {
            path: '/teacher',
            component: () => import('@/components/teacher/Info/Info'),
            children: [
                {
                    path: 'updatePwd',
                    component: () => import('@/components/teacher/UpdatePwd/UpdatePwd')
                },
                {
                    path: 'updateInfo',
                    component: () => import('@/components/teacher/UpdateInfo/UpdateInfo')
                },
                {
                    path: 'address',
                    component: () => import('@/components/teacher/Address/Address')
                },
                {
                    path: 'order',
                    component: () => import('@/components/teacher/Order/Order')
                }, {
                    path: 'orderHistory',
                    component: () => import('@/components/teacher/OrderHistory/OrderHistory')
                }

            ]
        },
        {
            path: '/worker',
            component: () => import('@/components/admin/Manage/Manage'),
            children: [{
                path: 'updatePwd',
                component: () => import('@/components/admin/UpdatePwd/UpdatePwd')
            }, {
                path: 'updateInfo',
                component: () => import('@/components/admin/UpdateInfo/UpdateInfo')
            }, {
                path: 'user',
                component: () => import('@/components/admin/User/User')
            }, {
                path: 'findOrder',
                component: () => import('@/components/admin/FindOrder/FindOrder')
            }, {
                path: 'printOrder',
                component: () => import('@/components/admin/PrintOrder/PrintOrder')
            }, {
                path: 'checkIn',
                component: () => import('@/components/admin/CheckIn/CheckIn')
            }, {
                path: 'finish',
                component: () => import('@/components/admin/DistributeOrder/DistributeOrder')
            }, {
                path: 'history',
                component: () => import('@/components/admin/History/History')
            }
            ]
        }
    ]
});

// 通用组件

// 顶部红条
Vue.component('top', () => import('@/components/common/top/top'));
// 底部版本信息
Vue.component('bottom', () => import('@/components/common/bottom/bottom'));
// 订单通用模块
Vue.component('order', () => import('@/components/admin/OrderTable/OrderTable'));

